package alingrad.engine.src.collisions;

/**
 * Class that checks for collisions.
 * @author alingrad
 *
 */
public class Collisions {

	/**
	 * Checks whether or not the two objects collide.
	 * @param object1 the first object.
	 * @param object2 the second object.
	 * @return whether or not the two objects collide.
	 */
	public static boolean checkCollision(Collidable object1, Collidable object2) {
		return object1.getMask().collidesWith(object2.getMask());
	}

	/**
	 * Checks whether an object collides with a point.
	 * @param object the object
	 * @param x the x position of the point.
	 * @param y the y position of the point.
	 * @return whether or not the object collides with the point.
	 */
	public static boolean checkCollision(Collidable object, float x, float y) {
		return object.getMask().collidesWith(x, y);
	}

	/**
	 * Checks whether or not the bounding box of two objects collide.
	 * @param object1 the first object.
	 * @param object2 the second object.
	 * @return whether or not the bounding box of the two objects collide.
	 */
	public static boolean checkBoundingBoxCollision(Collidable object1, Collidable object2) {
		return object1.getMask().checkBoundingBoxCollision(object2.getMask());
	}

	/**
	 * Checks whether the bounding box of an object collides with a point.
	 * @param object the object
	 * @param x the x position of the point.
	 * @param y the y position of the point.
	 * @return whether or not the object collides with the point.
	 */
	public static boolean checkBoundingBoxCollision(Collidable object, float x, float y) {
		return object.getMask().checkBoundingBoxCollision(x, y);
	}

}
